<?php
$arguments['title'] = '用户列表';
$arguments['location'] = array(
    "首页",
    "用户管理",
    "用户列表",
);
$arguments['css'] = array(
    PUBLIC_LIB.'js/core/Pagination/kkpager_orange.css',
    PUBLIC_LIB.'fonts/hui_iconfont/iconfont.css',
    PUBLIC_LIB.'css/biz/enhanced.css',
    PUBLIC_LIB.'js/core/Dropdownlist/chosen.css',
    PUBLIC_LIB.'js/jquery/jquery-ui-1.11.4.custom/jquery-ui.css',
);
$arguments['js'] = array(
    PUBLIC_LIB.'js/core/Pagination/kkpager.min.js',
    PUBLIC_LIB.'js/core/DatePicker/WdatePicker.js',
    PUBLIC_LIB.'js/biz/custominput.js', 
    PUBLIC_LIB.'js/core/Dropdownlist/chosen.jquery.js',  
    PUBLIC_LIB.'js/biz/pagelist.js',
    PUBLIC_LIB.'js/core/Tooltip/tooltip.js',
    PUBLIC_LIB.'js/jquery/jquery-ui-1.11.4.custom/jquery-ui.js',
    PUBLIC_LIB.'js/ajaxupload/ajaxfileupload.js',
    PUBLIC_LIB.'js/biz/ajaxfun.js',
    PUBLIC_LIB.'js/biz/userlist.js',     
);
importHeader($arguments);
?>
<div class="formtitle"><span>用户列表</span></div>
    <div class="search">
     <FORM id="form" method="post">
        <p>
            <div class="label_title">
                <label for="userName">用户名：</label>
            </div>
            <div class="search_text">
                <input  type="text" class="dfinput search_width" id="userName" name="userName" value="<?php if(isset($userName)){echo $userName;}?>"/>
            </div>
            <button type="button" class="tool tool_left" id="search"><i class="Hui-iconfont">&#xe683;</i>查询</button>
            <a href="#" onclick="createUser();" class="tool_right"><div class="tool  tool_btn"><i class="Hui-iconfont">&#xe600;</i>添加用户</div></a>
        </p>
       </FORM>     
    </div>
    <div class="table_box tablelist">
        <table width="100%">
            <tr>
                <th width="15%">用户名</th>
                <th width="20%">真实名</th>
                <th width="10%">职位</th>
                <th width="15%">联系电话</th>
                <th width="5%">状态</th>
                <th width="10%">创建时间</th>
                <th width="25%">操作</th>
            </tr>
        </table>
        <table width="100%">
            <?php
                if(isset($userList) && !empty($userList->list) && count($userList->list)>0){//
                    foreach($userList->list as $user){
                        echo '<tr>
                            <td width="15%">',$user->userName,'</td>  
                            <td width="20%">',$user->realName,'</td>  
                            <td width="10%">',$user->position,'</td> 
                            <td width="15%">',$user->phone,'</td> 
                            <td width="5%">',$user->state,'</td> 
                            <td width="10%">',$user->createTime,'</td> 
                            <td width="25%"> 
                            <a href="#" onclick="userDetail(\'',$user->adminId,'\');"><div class="tools tool_left"><i class="Hui-iconfont">&#xe60c;</i>编辑</div></a>
                            <a href="#" onclick="userDelete(\'',$user->adminId,'\',\'',$user->userName,'\');"><div class="tools tool_left"><i class="Hui-iconfont">&#xe609;</i>删除</div></a>';
                        if($user->status == 0)
                            echo '<a href="#" onclick="userStatus(\'',$user->adminId,'\',1,\'',$user->userName,'\')"><div class="tools tool_left"><i class="Hui-iconfont">&#xe615;</i>启用</div></a>';
                        else
                            echo '<a href="#" onclick="userStatus(\'',$user->adminId,'\',0,\'',$user->userName,'\')"><div class="tools tool_left"><i class="Hui-iconfont">&#xe631;</i>禁用</div></a>'; 
                        echo '<div class="tools tool_left tool_btn"><i class="Hui-iconfont"></i>操作
                        <div class="tool_box">
                            <ul>
                            <a href="#" onclick="distributRole(\'',$user->adminId,'\');"><li id="tool1" >分配角色</li></a>
                            <a href="#" onclick="distributAuth(\'',$user->adminId,'\');"><li id="tool1">特殊赋权</li></a>';
                           echo '</ul></div></div></td></tr>';
                    }
                }else{
                    echo '<tr><td colspan="7">',isset($noAuth)?$noAuth:"",'没有查询到任何管理员</td></tr>';
                }
            ?> 
            
        </table>
    </div>
     <div class="pager" id="kkpager" data-total="<?php 
        if (empty($userList->list))
        {
            echo 1;
        }
        else 
        {
            echo $userList->page; 
        }
        ?>"></div>
<?php importFooter();?>